﻿using System;
using System.Xml.Serialization;
using System.Text;
public class OrderDetails
{
    public string ProductName { get; set; }
    public int Quantity { get; set; }
    public int Price { get; set; }
    public OrderDetails()
    {
        ProductName = "productToBeCreate";
        Quantity = 0;
        Price = 0;
    }
    public OrderDetails(string productName, int quantity, int price)
    {
        ProductName = productName;
        Quantity = quantity;
        Price = price;
    }

    public override string ToString()
    {
        return "订单明细：\r\n" +
            "商品名称：" + ProductName + "\r\n" +
            "交易数量：" + Quantity + "\r\n" +
            "商品价格：" + Price + "\r\n";
    }
}
public class Order
{
    public int Id { get; set; }
    public string Customer { get; set; }
    public int Sum { get; set; }
    public OrderDetails Details;
    public Order()
    {
        Id = 0;
        Customer = "小明";
        Sum = 0;
        Details = new OrderDetails();
    }
    public Order(int id, string customer, int sum, string productName, int quantity, int price)
    {
        Id = id;
        Customer = customer;
        Sum = sum;
        Details = new OrderDetails(productName, quantity, price);
    }
    public override string ToString()
    {
        return "订单：\r\n" +
            "订单Id：" + Id + "\r\n" +
            "客户姓名：" + Customer + "\r\n" +
            "订单总价：" + Sum + "\r\n" +
            Details + "\r\n";
    }
}